/*
 * SincronyzedQueue.cpp
 *
 *  Created on: 21/07/2011
 *      Author: jairo
 */

#include "bilbao/protocol/serial/SincronyzedQueue.h"

namespace bilbao
{
	namespace protocol
	{
		namespace serial
		{
			//--------------------------------------------------------------------------------
			SincronyzedQueue::SincronyzedQueue( void )
				: _sincronyzedQueue(), _mtx()
			{
				// Do nothing
			}
			//--------------------------------------------------------------------------------
			SincronyzedQueue::~SincronyzedQueue( void )
			{
				// Do nothing
			}
			//--------------------------------------------------------------------------------
			void SincronyzedQueue::push( const String& str )
			{
				lang::MutexLocker ml( _mtx );
				_sincronyzedQueue.push( str );
			}
			//--------------------------------------------------------------------------------
			void SincronyzedQueue::pop( String& str )
			{
				lang::MutexLocker ml( _mtx );
				str = _sincronyzedQueue.front();
				_sincronyzedQueue.pop();
			}
			//--------------------------------------------------------------------------------
			bool SincronyzedQueue::empty( void )
			{
				return _sincronyzedQueue.empty();
			}
		} // namespace serial
	} // namespace protocol
} // namespace bilbao
